<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <script src="https://cdn.jsdelivr.net/npm/vue@2.6.11"></script>
    <style>
        .inner{
            height: 200px;
            width: 200px;
            background-color: blanchedalmond;
        }
        a{
            text-decoration: none;
        }
    </style>
</head>
<body>
    <!-- 
        .stop 阻止冒泡
        .prevent 阻止默认事件
        .capture 添加事件侦听器时用事件捕获模式
        .self 只当事件在该元素本素（比如不是子元素）触发时触发回调
        .once 事件只触发一次
     -->

    <div id="app">
        <div class="inner" @click="innerDivHandler">
            <input type="button" value="button" @click.stop="buttonHandler">
        </div>
        <br>
        <hr>
        <br>

        <a href="https://www.baidu.com" target="_blank" @click.prevent.once>百度一下</a>
        <br>
        <hr>
        <br>
        <!-- 先触发捕获到的div  -->
        <div class="inner" @click.capture="innerDivHandler">
            <input type="button" value="button" @click="buttonHandler">
        </div>

        <br>
        <hr>
        <br>
     
        <div class="inner" @click.self="innerDivHandler">
            <input type="button" value="button" @click="buttonHandler">
        </div>
    </div>
    <script>
        var vm=new Vue({
           el:'#app',
           data:{
              
           },
           methods:{
            innerDivHandler(){
                console.log("我是 inner div");
            },
            buttonHandler(){
                console.log('我是 button 按钮');
                
            }

           }
        });
    </script>
</body>

</html>